CPPFLAGS=-Isrc -O2 -Wall -c -fmessage-length=0 -fPIC -MMD -MP

all: libodbclogger.so

libodbclogger.so: src/*.cpp src/*.h
	@g++ $(CPPFLAGS) -MF"src/DynLib.d" -MT"src/DynLib.d" -o"src/DynLib.o" "src/DynLib.cpp"
	@g++ $(CPPFLAGS) -MF"src/ODBCWrapper.d" -MT"src/ODBCWrapper.d" -o"src/ODBCWrapper.o" "src/ODBCWrapper.cpp"
	@g++ $(CPPFLAGS) -MF"src/ODBCLoggingDriver.d" -MT"src/ODBCLoggingDriver.d" -o"src/ODBCLoggingDriver.o" "src/ODBCLoggingDriver.cpp"
	@gcc -shared -Wl,-soname,libodbclogger.so -o libodbclogger.so src/*.o -lc -lodbc -lstdc++

clean:
	@echo "Cleaning..."
	find . -name "*.a" -exec rm -f {} \;
	find . -name "*.d" -exec rm -f {} \;
	find . -name "*.o" -exec rm -f {} \;
	find . -name "*.so" -exec rm -f {} \;

